/**
 * Created by AllanXu on 01/03/2016.
 */
define(function (require) {
	var Vue = require('vue'),
		Config = require('config'),
		_ = require('ajax'),
		utilities = require('utilities');

	var app = new Vue({
		el: '#uc_pairlist',
		data: {
			renderObj: {},
			picServer: Config.picServer,
			num:0
		},
		methods: {
			init: function () {
				//_(Config.SERVICE.MATES.LIST, {
				//	id: sessionStorage.id
				//}, function (data) {
				//	app.renderObj = data.pageitems;
				//});
                var userInfo = JSON.parse(decodeURIComponent(atob(sessionStorage.userInfo)));
				/*var cs_sex=userInfo.member.sex;
				if(cs_sex==402)
                    cs_sex=403;
				else
                    cs_sex=402;
                _(Config.SERVICE.INDEX.LIST + '?pagesize=10&pageno='+app.num+'&xgmember.sex=' + cs_sex +'&xgmember.areaCode=' + userInfo.member.areaCode,
                    {},
                    function (data) {
                        app.renderObj = data.pageitems;
                        if(data.pagecount<=app.num)
                        	app.num=0;
                    });*/
                _(Config.SERVICE.INDEX.LISTSP + '?id=' + userInfo.member.id,{},
                    function (data) {
                        app.renderObj = data.pageitems;
                        //if(data.pagecount<=app.num)
                        //	app.num=0;
                    });
			},
			go: function (url) {
				location.href = url;
			},
            hyz:function () {
                var userInfo = JSON.parse(decodeURIComponent(atob(sessionStorage.userInfo)));
                var cs_sex=userInfo.member.sex;
                if(cs_sex==402)
                    cs_sex=403;
                else
                    cs_sex=402;
                app.num=app.num+1;
                _(Config.SERVICE.INDEX.LIST + '?pagesize=10&pageno='+app.num+'&xgmember.sex=' + cs_sex +'&xgmember.areaCode=' + userInfo.member.areaCode,
                    {},
                    function (data) {
                        app.renderObj = data.pageitems;
                        if(data.pagecount<=app.num)
                            app.num=0;
                    });
            }
		}

	});
	app.init();
});
